import pandas as pd

# 创建示例数据
data1 = {
    "姓名": ["张三丰", "郭靖", "梅超风", "李世民"],
    "年龄": [25, 30, 35, 40],
    "城市": ["西安", "深圳", "北京", "广州"],
}

data2 = {
    "产品": ["苹果", "橙子", "香蕉", "葡萄"],
    "数量": [5, 10, 7, 8],
    "价格": [1.2, 0.8, 0.5, 2.0],
}


def excel_write(*args, filename="x.xlsx"):
    data1 = pd.DataFrame(args[0]["data"])
    data2 = pd.DataFrame(args[1]["data"])
    with pd.ExcelWriter(filename) as writer:
        data1.to_excel(writer, sheet_name=args[0]["sheet_name"])
        data2.to_excel(writer, sheet_name=args[1]["sheet_name"])


if __name__ == "__main__":
    d1 = {"sheet_name": "人物信息", "data": data1}
    d2 = {"sheet_name": "水果信息", "data": data2}
    excel_write(d1, d2, filename="info.xlsx")
